package com.ksd.modules.rbac.roles.controller;

import com.ksd.common.controller.BaseController;
import com.ksd.common.core.result.R;
import com.ksd.modules.rbac.roles.service.ISysUserRolesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户角色表 前端控制器
 * </p>
 *
 * @author Auto Generator
 * @since 2023-08-13
 */
@RestController
public class SysUserRolesController  extends BaseController {


    @Autowired
    private ISysUserRolesService sysUserRolesService;

    // 查询用户角色授权角色列表
    @PostMapping("/sys/user/roles")
    public R<List<Long>> findUserRoles(@RequestParam Long userId){
        return R.data(sysUserRolesService.findUserRoles(userId));
    }

    // 保存用户角色授权
    @PostMapping("/sys/user/roles/save")
    public R<Boolean> saveUserRoles(@RequestParam Long userId,@RequestParam String roleIds){
        return R.data(sysUserRolesService.saveUserRoles(userId,roleIds));
    }

}
